<template>
	<view class="comment">
		<view class="main">
			<u--textarea v-model.trim="content" placeholder="请输入内容"></u--textarea>
		</view>
		
		
		<view class="btn" @click="comment">评论</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				content: '',
				id: ''
			}
		},
		onLoad(option) {
			this.id = option.id
		},
		methods: {
			comment(){
				if(this.content == ''){
					this.$toast('请输入评论内容')
					return
				}
				this.$api.post('/discovercomment',{
					id: this.id,
					content: this.content
				}).then(res => {
					if (res.code == 1) {
						this.$toast(res.msg)
						uni.$emit('comment')
						setTimeout(()=>{
							this.$back();
						},1000)
					}
				}).catch((res) => {
							
				})
			}
		}
	}
</script>

<style scoped lang="scss">
.comment{
	height: 100vh;
	background: #FAFAFA;
	.main{
		padding: 30rpx;
		background: #FAFAFA;
	}
	.btn {
		margin-top: 200rpx;
		margin: auto;
		display: flex;
		justify-content: center;
		align-items: center;
		width: 690rpx;
		height: 100rpx;
		background: #00CE9B;
		border-radius: 30rpx;
		font-size: 32rpx;
		font-weight: 400;
		color: #FFFFFF;
		line-height: 48rpx;
		z-index: 999;
	}
}
</style>
